﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminMaster.Master" Inherits="System.Web.Mvc.ViewPage<VietThuongLMS.Account>" %>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="<%: Url.Content("~/Scripts/MicrosoftAjax.js") %>"></script>
    <script type="text/javascript" src="<%: Url.Content("~/Scripts/MicrosoftMvcValidation.js") %>"></script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<legend>
        <h2>
            Cập nhật tài khoản</h2>
    </legend>
    <% Html.EnableClientValidation();
       using (Html.BeginForm("Edit", "Account", new { area = "Admin" }, FormMethod.Post, new { @class = "form-horizontal", @id = "formNew", @name = "formNew", enctype = "multipart/form-data" }))
       {
    %>
    <input type="hidden" id="hCheckedBook" name="hCheckedBook" />
    <%: Html.ValidationSummary(true) %>
    <div class="control-group">
        <label class="control-label" for="strFrom">
            User name:</label>
        <div class="controls">
            <%: Html.TextBoxFor(t => t.userName, new { @class = "h30", placeholder = "user name...", @readonly = true })%>
            <%: Html.ValidationMessageFor(m => m.userName)%>
        </div>
    </div>
    <div class="control-group">
        <div class="controls">
            <a class="btn btn-danger" onclick="resetPass()">Reset Password</a> (Default: 123456)
        </div>
    </div>
    
    <div class="control-group">
        <label class="control-label" for="strFrom">
            Họ tên :</label>
        <div class="controls">
            <%: Html.TextBoxFor(t => t.fullName, new { @class = "h30", placeholder = "full name..." })%>
            <%: Html.ValidationMessageFor(m => m.fullName) %>
            
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="strFrom">
            Địa chỉ :</label>
        <div class="controls">
            <%: Html.TextBoxFor(t => t.address, new { @class = "h30", placeholder = "Address..." })%>
            <%: Html.ValidationMessageFor(m => m.address)%>
            
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="strFrom">
            Điện thoại :</label>
        <div class="controls">
            <%: Html.TextBoxFor(t => t.phone, new { @class = "h30", placeholder = "Phone..." })%>
            <%: Html.ValidationMessageFor(m => m.phone)%>
            
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="strFrom">
            Email :</label>
        <div class="controls">
            <%: Html.TextBoxFor(t => t.email, new { @class = "h30", placeholder = "Email..." })%>
            <%: Html.ValidationMessageFor(m => m.email)%>
            
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="AdminContent">
            Quyền:</label>
        <div class="controls">
            <%= Html.DropDownList("roleId", (SelectList)ViewData["CBRole"])%>     
        </div>
    </div>
    <div class="control-group">
        <div class="controls">
            <button id="btnCreate" name="btnCreate" type="submit" class="btn btn-primary">Save</button>
        </div>
    </div>
    <% } %>
    
    <script type="text/javascript" src="<%: Url.Content("~/Plugins/datepicker/js/bootstrap-datepicker.js")%>"></script>
    <script type="text/javascript" src="<%: Url.Content("~/Scripts/MainJS.js")%>"></script>
    <script type="text/javascript">
        var pathServer = '<%=Url.Content("~")%>';
        function resetPass() {
            if (document.getElementById("userName") != null) {
                $.post(pathServer + 'Admin/Account/ResetPass?userid=' + document.getElementById("userName").value, {}, function (data) {
                    if (data == "0") {
                        alert("Failed");
                    } else {
                        alert("Password reset successfully");
                    }
                });
            }
        }
    </script>
</asp:Content>


